import React, { useState } from 'react';

import LoginRegisCommonBg from '@/components/LoginRegisCommonBg';
import QrCodePage from '@/components/QrCodePage';
import MsnLogin from '@/pages/Login/MsnLogin';
import UserLogin from '@/pages/Login/UserLogin';

const Login: React.FC = () => {
  const [isMsnOrUser, setIsMsnOrUser] = useState(0);
  const switchMsnOrUser = (is: number) => {
    setIsMsnOrUser(is);
  };
  const switchLoginForm = () => {
    switch (isMsnOrUser) {
      case 1:
        return <MsnLogin switchMsnOrUser={switchMsnOrUser} />;
      case 2:
        return (
          <QrCodePage
            qrcodeUrl={
              'https://hbimg.huabanimg.com/f26f5ed0d000c3413c9a4250f2c22bcb86a9494e2b2a-Gw0bYT_fw658/format/webp'
            }
            isLogin={true}
            switchTabPage={switchMsnOrUser}
          />
        );
      default:
        return <UserLogin switchMsnOrUser={switchMsnOrUser} />;
    }
  };
  return <LoginRegisCommonBg>{switchLoginForm()}</LoginRegisCommonBg>;
};
export default Login;
